﻿using Catastrophe.Initialize;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Catastrophe.BasePC.UI.UI
{
    /// <summary>
    /// 系统配置
    /// </summary>
    public partial class UcFileConfig : UserControl
    {
        public UcFileConfig()
        {
            InitializeComponent();
            this.Loaded += UcFileConfig_Loaded;
        }

        private void UcFileConfig_Loaded(object sender, RoutedEventArgs e)
        {
            tabControl.Items.Clear();
            List<IFrameFileConfig> assemblyInstanceList = CatastropheInitializer.GetAssemblyInstanceList<IFrameFileConfig>();
            foreach (IFrameFileConfig config in assemblyInstanceList)
            {
                TabItem tabItem = new TabItem();
                tabItem.Header = config.heandText;
                tabItem.Content = config;
                var style =  this.FindResource("TabItemStyle");
               // var style=  Application.Current.FindResource("TabItemStyle");
                tabItem.SetValue(TabItem.StyleProperty, style);
                tabControl.Items.Add(tabItem);
            }
            if (tabControl.Items.Count>0)
            {
                tabControl.SelectedIndex = 0;
            }
        }
    }
}
